<html>
<?php
/**********************************INCLUDE*********************************** *
* **************************************************************************** */
include('../Lib/php/HTMLMgrDef.php');
include('../Lib/php/DBMgrDef.php');
?>

<?php
/*********************************CONSTANT*********************************** *
* **************************************************************************** */
define("STYLE", "http://localhost/Glyph/Game/register-style.css");
define("MAIN_LOGO", "http://localhost/Glyph/Game/logos/glyphlogo.png");
?>
    
<?php 
session_start();
error_reporting(E_ALL ^ E_NOTICE); 
?>
    
<?php
/************************************MAIN************************************ *
* Script Name: register.php
* Author: cf.Studios
* Description: This script handles registering a new user for the game.
***************************************************************************** */
if(!isset($_SESSION["action"]))
{
    printPage();
}  
   
/**********************************FUNCTION********************************** *
* Function Name: printPage
* Author: Nicholas Malacarne
* Parameters: NONE
* Description: Constructs the registration page and prints it to the screen.
***************************************************************************** */
function printPage()
{
/* Object to hold all of our HTML with an author name and title.
 */$HTML = new HTMLMgrDef("cf.Studios", "Glyph Registration");
 
/* Specifies a .css file for the page to utilize.
 */$HTML->setCSS(STYLE);
 
/* Starts the HTML <head> section of our page.
 */$HTML->startHTMLHead();
 
 /*TODO: Add JavaScript here! */
 
   $HTML->endHTMLHead();
   
/* Starts the HTML <body> section of our page.
 */$HTML->startHTMLBody();
 
   $HTML->startDiv("BODY", "banner");
   $HTML->addTag("BODY", "center", $HTML->getImg(MAIN_LOGO));
   $HTML->endDiv("BODY");
   $HTML->startDiv("BODY", "body");
   
/* Creates an entity to hold all of the HTML for a table. This entity does not 
 * exist on the page at creation. We can 'glue' it to the page later by
 * using a specific member function.
 */$HTML->createEntity("table");
   
/* Creates a table using HTML.
 */$HTML->startTable("table", 1);
   $HTML->startTRow("table");
   $HTML->addTHeader("table", "Register:", 2);
   $HTML->endTRow("table");
   $HTML->startTRow("table");
   $HTML->addTData("table", "Account Name:");
   $HTML->addTData("table", $HTML->getInBox("text", "accName"));
   $HTML->endTRow("table");
   $HTML->startTRow("table");
   $HTML->addTData("table", "Password:");
   $HTML->addTData("table", $HTML->getInBox("password", "pass"));
   $HTML->endTRow("table");
   $HTML->startTRow("table");
   $HTML->addTData("table", "Retype Password:");
   $HTML->addTData("table", $HTML->getInBox("password", "passChk"));
   $HTML->endTRow("table");
   $HTML->startTRow("table");
   $HTML->addTHeader("table", $HTML->getInButton("submit", "Register!"), 2);
   $HTML->endTRow("table");
   $HTML->endTable("table");
   
/* Creates an entity to hold the HTML for a form.
 */$HTML->createEntity("form");
 
/* Creates an HTML form and puts our table inside.
 */$HTML->startForm("form", "register", "post");
   $HTML->addTag("form", "center", $HTML->getEntity("table"));
   $HTML->endForm("form");
   
/* Adds our form to the body entity.
 */$HTML->addHTML("BODY", $HTML->getEntity("form"));
   
   $HTML->endDiv("BODY");
   $HTML->endHTMLBody();
   
/* Adds our entities to the actual page.
 */$HTML->glue($HTML->getEntity("HEAD"));
   $HTML->glue($HTML->getEntity("BODY"));
   
/* Prints out the HTML page.
 */print $HTML->getPage();
}
?>  
</html>
